package com.atguigu.cmsservice.controller;


import com.atguigu.cmsservice.entity.CrmBanner;
import com.atguigu.cmsservice.service.CrmBannerService;
import com.atguigu.commonutils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 首页banner表 前端控制器
 * </p>
 * 前台接口
 *
 * @ author zr
 * @since 2021-11-17
 */
@RestController
@Api(tags = "网站首页Banner列表")
@RequestMapping("/cms/service/banner")
//@CrossOrigin
public class BannerFrontController {
    @Autowired
    private CrmBannerService crmBannerService;

    /**
     * 查询所有的Banner
     * 用于前台展示
     *
     * @return
     */
    @ApiOperation(value = "获取首页banner")
    @GetMapping("findAllBanner")
    public Result findAllBanner() {
        List<CrmBanner> crmBannerList = crmBannerService.findAllBanner();
        return Result.ok(crmBannerList);
    }
}

